package com.hopes.bizz.close.gis.controller;

import cn.hutool.core.collection.CollUtil;
import com.hopes.bizz.close.basic.dto.ClosedRoadDTO;
import com.hopes.bizz.close.common.constant.CloseModuleEnums;
import com.hopes.bizz.close.gis.dto.AccessRecordDTO;
import com.hopes.bizz.close.gis.dto.GateRecordDTO;
import com.hopes.bizz.close.gis.service.ClosedLayerService;
import com.hopes.bizz.close.gis.vo.GateAccessLayerVO;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

/**
 * @author yumr
 * @ProjectName bizz
 * @Description 图层接口
 * @time 2024/2/23 9:39
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/layer")
@Tag(description = "layer", name = "封闭化管理一张图")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ClosedLayerController {

    private final ClosedLayerService closedLayerService;

    /**
     * 危险品车辆基本信息
     */
    @Operation(summary = "危险品车辆基本信息", description = "危险品车辆基本信息")
    @GetMapping("/hazard/car/{applyId}")
    public R queryHazardCarInfo(@PathVariable("applyId") Long applyId) {
        return R.ok(closedLayerService.queryHazardCarInfo(applyId));
    }


    /**
     * 园区卡口/门禁
     */
    @Operation(summary = "园区卡口/门禁", description = "园区卡口/门禁")
    @GetMapping("/gate/access/{type}")
    public R queryGateAccessByType(@PathVariable("type") CloseModuleEnums.ParkCompanyTypeEnum parkCompanyTypeEnum) {
        return R.ok(closedLayerService.queryGateAccessByType(parkCompanyTypeEnum));
    }

    /**
     * 园区、企业卡口通行记录
     */
    @Operation(summary = "园区、企业卡口通行记录", description = "园区、企业卡口通行记录")
    @PostMapping("/gate/record")
    public R queryLayerGateRecord(@RequestBody GateRecordDTO gateRecordDTO) {
        return R.ok(closedLayerService.queryLayerGateRecord(gateRecordDTO));
    }


    /**
     * 园区、企业门禁通行记录
     */
    @Operation(summary = "园区、企业门禁通行记录", description = "园区、企业门禁通行记录")
    @PostMapping("/access/record")
    public R queryLayerAccessRecord(@RequestBody AccessRecordDTO accessRecordDTO) {
        return R.ok(closedLayerService.queryLayerAccessRecord(accessRecordDTO));
    }


    /**
     * 分区管控
     */
    @Operation(summary = "分区管控", description = "分区管控")
    @GetMapping("/control/area")
    public R queryLayerControlArea() {
        return R.ok(closedLayerService.queryLayerControlArea());
    }

    /**
     * 园区车道
     */
    @Operation(summary = "园区车道", description = "园区车道")
    @PostMapping("/road")
    public R queryLayerRoad(@RequestBody ClosedRoadDTO closedRoadDTO) {
        return R.ok(closedLayerService.queryLayerRoad(closedRoadDTO));
    }

}
